package com.hs.srm.admin.modules.orders.service.impl;

import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.mapper.Wrapper;
import com.baomidou.mybatisplus.plugins.Page;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import com.hs.srm.admin.modules.orders.dao.DeliverDao;
import com.hs.srm.admin.modules.orders.dao.ScmPoItemDao;
import com.hs.srm.admin.modules.orders.entity.DeliverEntity;
import com.hs.srm.admin.modules.orders.service.DeliverService;
import com.hs.srm.base.common.utils.QueryParam;
import com.hs.srm.common.utils.PageUtils;

/**
 * 采购订单行项目Service实现
 * 
 * @author Sunnykid
 *
 * @date 2019年3月17日
 */
@Service("deliverService")
public class DeliverServiceImpl extends ServiceImpl<DeliverDao, DeliverEntity> implements DeliverService {
    
	@Autowired
	private DeliverDao deliverDao;
	
	@Override
	public PageUtils selectDetailPage(Map<String, Object> params) {
		Page<DeliverEntity> page = this.selectDetailPage(new QueryParam<DeliverEntity>(params).getPage(),
				new EntityWrapper<DeliverEntity>(), params);
		return new PageUtils(page);
}

	private Page<DeliverEntity> selectDetailPage(Page<DeliverEntity> page, Wrapper<DeliverEntity> wrapper,
			Map<String, Object> params) {
		page.setRecords(this.deliverDao.selectDetailPage(page, wrapper, params));
		return page;
	}

	/**
     * 
     * 批量查询发货的数据
     */
	@Override
	public List<DeliverEntity> findById(List<String> idList) {
		
		return this.baseMapper.findById(idList);
	}
    /**
     * 新增发货数据
     */
	@Override
	public int insertDeliver(DeliverEntity deliverEntity) {
		
		return this.baseMapper.insertDeliver(deliverEntity);
	}
    
	/**
	 * 根据行项目id更新
	 */
	@Override
	public int updaeDeliver(DeliverEntity deliverEntity) {
		
		return this.baseMapper.updaeDeliver(deliverEntity);
	}

	@Override
	public DeliverEntity selectByItemId(String Itemid){
	
		return this.baseMapper.selectByItemId(Itemid);
	}

}
